DIR_CLIB = ./src/java/main/resources
DIR_CSRC = ./src/c
SO       = libjnaex.so
PLATFORM = linux-x86-64

CSRC     = $(wildcard ${DIR_CSRC}/*.c)
COBJ     = $(patsubst %.c, %.o, ${CSRC})

CFLAGS   = -Wall -fmessage-length=0 -fPIC
LDFLAGS += -shared

all : $(SO) java run

run:
	java -jar target/jnaex-0.0.1-snapshot.jar

$(SO) : $(COBJ)
	@ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $(DIR_CLIB)/$(PLATFORM)/$@

java:
	@ mvn package -Dmaven.test.skip=true

.PHONY : clean
clean :
	@ mvn clean
	@ rm -rf $(DIR_CLIB)/$(PLATFORM)/$(SO) $(COBJ)

so : $(SO)
	objdump -t $(DIR_CLIB)/$(PLATFORM)/$(SO) | grep jnaex_
